// src/plugins/socket.js

import Vue from 'vue';
import VueSocketIO from 'vue-socket.io';
import SocketIO from 'socket.io-client';

const socketInstance = SocketIO(`${process.env.SOCKET_URL}?token=kG8qA6qG1aP5aR3g`, {
  autoConnect: process.env.NODE_ENV === 'development',
  transports: ['websocket'],
});

Vue.use(
  new VueSocketIO({
    debug: true,
    connection: socketInstance,
  }),
);

export default socketInstance;
